package com.ohimy.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 资讯封装类
 * 
 * @author Tony Tang
 * @version 1.0
 */
@Entity
@MappedSuperclass
@Table(name = "ohimy_info_item")
public class InfoItem implements Serializable {

	private static final long serialVersionUID = 1L;

	private long id;

	private InfoSubSort infoSubSort; // 所属二级分类

	private String name; // 字号

	private String title; // 显示在板块中的标题，做软文推广

	private String intro; // 介绍

	private String per;// 人均消费

	private String address;// 地址

	private String tel;// 电话

	private String logo;// 店铺照片

	private int clicked;// 点击次数

	private int check;// 审核状态

	private Date created; // 发布时间

	private List<InfoItemComment> infoItemComment;// 评价

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY, optional = false)
	public InfoSubSort getInfoSubSort() {
		return infoSubSort;
	}

	public void setInfoSubSort(InfoSubSort infoSubSort) {
		this.infoSubSort = infoSubSort;
	}

	@Column(name = "_name", length = 32)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "_title", length = 32)
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Lob
	@Column(name = "_intro")
	public String getIntro() {
		return intro;
	}

	public void setIntro(String intro) {
		this.intro = intro;
	}

	@Column(name = "_per", length = 8)
	public String getPer() {
		return per;
	}

	public void setPer(String per) {
		this.per = per;
	}

	@Column(name = "_address")
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "_tel", length = 32)
	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	@Column(name = "_logo", length = 64)
	public String getLogo() {
		return logo;
	}

	public void setLogo(String logo) {
		this.logo = logo;
	}

	@Column(name = "_clicked")
	public int getClicked() {
		return clicked;
	}

	public void setClicked(int clicked) {
		this.clicked = clicked;
	}

	@Column(name = "_check")
	public int getCheck() {
		return check;
	}

	public void setCheck(int check) {
		this.check = check;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "_created", updatable = false)
	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	@OneToMany(mappedBy = "infoItem", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
	public List<InfoItemComment> getInfoItemComment() {
		return infoItemComment;
	}

	public void setInfoItemComment(List<InfoItemComment> infoItemComment) {
		this.infoItemComment = infoItemComment;
	}

}
